#define GPMCON	*((volatile unsigned int *)0x7F008820)
#define GPMDAT	*((volatile unsigned int *)0x7F008824)

#define LED_ON	1
#define LED_OFF	0

void led_init(void)
{
	GPMCON &= ~0xFFFF;
	GPMCON |= 0x1111;
}

void led_write(unsigned int led_num,int led_status)
{
	if(led_num >= 4) return;	
	
	if(led_status == LED_ON) GPMDAT &= ~(0x01<<led_num);
	else if(led_status == LED_OFF) GPMDAT |= (0x01<<led_num);
}

void led_toggle(unsigned int led_num)
{
	if(led_num >= 4) return;
	GPMDAT ^= (0x01<<led_num);
}
